﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace BLL
{
    public class WebSiteManager
    {
        public static DataSet GetAllWebSites(int parentId, string cultureName)
        {
            using (DataSet ds = BLL.BLLManager.ExecGetDSAllSP("WebSitesByParentId", new object[] { parentId, cultureName }))
            {
                ds.DataSetName = "WebSites";
                ds.Tables[0].TableName = "Category";
                ds.Tables[1].TableName = "WebSites";
                DataRelation relation = new DataRelation("ParentChild", ds.Tables["Category"].Columns["CategoryID"], ds.Tables["WebSites"].Columns["CategoryID"]);
                ds.Relations.Add(relation);
                return ds;
            }
        }

        public static int AddWebSite(int categoryID, string publisher, string language, string title, string description,string refurl,string screenshot)
        {
            string suserName = publisher;
            if (string.IsNullOrEmpty(publisher))
                suserName = "visitor";
            return BLL.BLLManager.ExceInsertToSP("WebSite",
                new object[]
                { 
                  categoryID, suserName, language,title, description,refurl,screenshot
                }
                );
        }
    }
}

